<template>
  <div>
    <el-dialog :visible="dialogTableVisible" width="40%" style="border-radius: 50px;" @close="close">
      <template slot="title">
        <span style="font-weight: 700;">新增点位</span>
      </template>
      <el-form ref="resetFields" :model="form" :rules="rules">
        <el-form-item label="点位名称" label-width="120px" prop="name">
          <el-input v-model="form.name" autocomplete="off" placeholder="请输入" maxlength="15" show-word-limit style="width: 450px;" />
        </el-form-item>
        <el-form-item label="所在区域" label-width="120px" prop="regionId">
          <el-select v-model="form.regionId" placeholder="请选择" style="width: 450px;">
            <el-option label="区域一" value="shanghai" />
            <el-option label="区域二" value="beijing" />
          </el-select>
        </el-form-item>
        <el-form-item label="活所属商圈" label-width="120px" prop="businessId">
          <el-select v-model="form.businessId" placeholder="请选择" style="width: 450px;">
            <el-option label="区域一" value="shanghai" />
            <el-option label="区域二" value="beijing" />
          </el-select>
        </el-form-item>
        <el-form-item label="归属合作商" label-width="120px" prop="ownerId">
          <el-select v-model="form.ownerId" placeholder="请选择" style="width: 450px;">
            <el-option label="区域一" value="shanghai" />
            <el-option label="区域二" value="beijing" />
          </el-select>
        </el-form-item>
        <el-form-item label="详细地址" label-width="120px">
          <el-select v-model="form.addr" placeholder="请选择" style="width: 450px;">
            <el-option label="区域一" value="shanghai" />
            <el-option label="区域二" value="beijing" />
          </el-select>

        </el-form-item>
        <el-form-item label-width="120px" prop="addr">
          <el-input v-model="form.addr" type="textarea" placeholder="请输入详情地址" maxlength="40" show-word-limit style="width: 450px;" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" style="display: flex; justify-content: center;margin-bottom: 20px;">
        <el-button style="background-color: #fbf4f0;border: none;" @click="close">取 消</el-button>
        <el-button type="primary" style="background-color: #ff6826;border: none;" @click="queRen">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: '',
  props: {
    dialogTableVisible: Boolean
  },
  data() {
    return {
      form: {
        name: '',
        regionId: '',
        businessId: '',
        ownerId: '',
        addr: ''

      },
      rules: {
        name: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        regionId: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        businessId: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        ownerId: [
          { required: true, message: '请输入', trigger: 'blur' }
        ],
        addr: [
          { required: true, message: '请输入', trigger: 'blur' }
        ]
      }
    }
  },
  computed: {
  },
  created() {
  },
  methods: {
    close() {
      this.$emit('update:dialogTableVisible', false)
      this.$refs['resetFields'].resetFields()
    },
    // 确认按钮触发函数
    queRen() {
      this.$refs['resetFields'].validate((valid) => {
        if (valid) {
          this.$emit('update:dialogTableVisible', false)
        } else {
          console.log('error submit!!')
          return false
        }
      })
    }

  }
}
</script>
<style lang='scss'  scoped>

 ::v-deep.el-textarea .el-textarea__inner   {
    height: 100px !important;
}
</style>
